#ifndef __AVR__
#define __AVR__

#include <iostream>

#include "avr-core.h"
#include "flash-memory.h"
#include "sram.h"
#include "clock-source.h"
#include "avr-builder.h"

class AVRBuilder;

using namespace std;

class AVR
{
public:
  void reset ();
  void run ();
  void stop ();
  void step ();
  void load_flash (istream& is);
  void dump_core_status (ostream& os);
  void dump_registers (ostream& os);
  void dump_dmem (uint8_t* buff, uint16_t addr, uint16_t cnt);
  void dump_pmem (uint16_t* buff, uint16_t addr, uint16_t cnt);
  void execute_instruction (uint16_t instruction);

private:
  friend class AVRBuilder;

  ClockSource* _clock;
  AVRCore* _core;
  FlashMemory* _flash;
  SRam* _sram;
  SRam* _regs;
};

#endif /* __AVR__ */
